package com.briup.ch11;

import java.io.*;

/**
 * @author yuxi
 * @version 1.0
 * @date 2025/10/16
 * @Description:
 */
public class Test15_ObjectOutputStream {
    //对象序列化输出
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("output.txt"));
        oos.writeObject(new Student("Tom",25));
        oos.close();

        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("output.txt"));
        if(ois.available()>0){
            Student s=(Student) ois.readObject();
            System.out.println(s);
        }
        ois.close();
    }




}
